<?php

	define("EB_PRIMARY_KEY",0x01);
	define("EB_INDEX_KEY",0x02);
	define("EB_UNIQUE_KEY",0x03);

	class EbTableColumn
	{
		var $name;
		var $type;
		var $not_null;
		var $key;
		var $autoincrement;
		var $default;
				
		public function __construct($name,$type,$not_null = true, $key = 0x00, $autoincrement = false,$default = null)
		{
			$this->name = $name;
			$this->type = $type;
			$this->not_null = $not_null;
			$this->key = $key;
			$this->autoincrement = $autoincrement;
			
			if (!$not_null)
			{
				if (preg_match("/^\\s*(varchar|text) /i",$type))
				{
					$default = "";
				}
				elseif (preg_match("/^\\s*(int|float|tinyint|smallint|bigint) /i",$type))
				{
					$default = 0;
				}
			}
			
			$this->default = $default;
		}
	}